package com.zy.集合.set.可变set

import scala.collection.mutable

object Test {
  def main(args: Array[String]): Unit = {

    // 可变set
    var set1: mutable.Set[Int] = mutable.Set(1, 2, 3, 4, 4)
    println(set1)

    // 添加元素
    set1 += 4
    set1.add(5)
    println(set1)

    // 删除元素
    set1 -= 1
    set1.remove(2)
    println(set1)

    // 合并set
    val set2: mutable.Set[Int] = mutable.Set(1, 2, 0)
    set2 ++= set1
    println(set2)
  }
}
